<?php
class Place_Model_AdminPlaceRate extends Zend_Db_Table{
    protected $_name  = "admin_place_rate";
    protected $_primary = "place_rate_id";
    
    public function save($arrParam){
        $row =  $this->fetchNew();
        foreach ($arrParam as $key => $value) {
            $row->$key = $value;
        }
        return $row->save();
    }
    
    public function isRated($placeId, $userId){
        $normalUtils = new My_Utils_NormalUtils();
        $DB = $normalUtils->getNormalDb(0);
        
        $select = $DB   ->select()
                        ->from('admin_place_rate')
                        ->where('global_user_id = ?',$userId)
                        ->where('place_id = ?',$placeId);
        $result = $DB->fetchAll($select);
        if(!empty($result)){
            return TRUE;
        }
        return FALSE;
    }
}
